import { defineStore } from 'pinia'
import {ref,type Ref} from 'vue'
import { ChatroomMessage } from '../dto/ChatroomMessage'
import { ChatroomUser } from '../dto/ChatroomUser'

export const useChatroomStore = defineStore("chatroomStore",()=>{

  const messageQueue:Ref<Array<ChatroomMessage>> = ref([])

  const chatroomUser = ref(null)

  // let s = localStorage.getItem("chatroomUser")
  // if(s){
  //   chatroomUser.value = JSON.parse(s)
  // }
  const chatroomUserList:Ref<Array<ChatroomUser>> = ref([])
  function $reset(){
    chatroomUser.value = null
  }
  return {messageQueue,chatroomUser,chatroomUserList,$reset}

})